package TreeSet_Stu;

public class Stu implements Comparable<Stu> {
	String name;
	int age;

	public Stu(String name, int age) {
		this.name = name;
		this.age = age;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	@Override
	// comparable接口
	public int compareTo(Stu E) {
		int num = this.age - E.age;
		int num2;

		if (num == 0) {
			num2 = this.name.compareTo(E.name);
			return num2;
		}

		return num;
	}

}
